// 所有的请求都放在该目录
import instance from "./request";

//获取首页数据列表
export function getIndexDate(params) {
    return instance({
        method:'get',
        url:'/index/index',
        params:params
    })
}

//分类页侧边所有请求
export function getPageDate(params) {
    return instance({
        method:'get',
        url:'/catalog/index',
        params:params
    })
}

// 当前页数据请求
export function getCurrentDate(params) {
    return instance({
        method: 'get',
        url: '/catalog/current',
        params: params
    })
}

// 删除商品请求
export function deleteCart(params) {
    return instance({
        method: 'post',
        url: '/cart/delete',
        data: params
    })
}

//专题页请求
export function getTopicDate(params) {
    return instance({
        method: 'get',
        url: '/topic/list',
        params: params
    })
}

// 购物车请求
export function getCartDate(params) {
    return instance({
        method: 'get',
        url: '/cart/index',
        params: params
    })
}

//搜索框商品搜索请求
export function getGoodsListDate(params) {
    return instance({
        method:'get',
        url:'/goods/list',
        params
    })
}

//我的页登录请求
export function getLoginDate(params) {
    return instance({
        method:'post',
        url:'/auth/loginByWeb',
        data:params
    })
}

//加入购物车请求
export function addCartDate(params) {
    return instance({
        method: 'post',
        url: '/cart/add',
        data: params,
    })
}

//获取购物车数量请求
export function getGoodsCountDate(params) {
    return instance({
        method:'get',
        url:'/cart/goodscount',
        params
    })
}

//详情页请求
export function getDetailDate(params) {
    return instance({
        method:'get',
        url:'/goods/detail',
        params
    })
}

//品牌详情请求
export function getBanderDetailDate(params) {
    return instance({
        method:'get',
        url:'/brand/detail',
        params
    })
}

// 实时搜索请求
export function getSearchHelperDate(params) {
    return instance({
        method:'get',
        url:'/search/helper',
        params
    })
}

// 清除历史记录请求
export function getClearHistoryDate(params) {
    return instance({
        method:'post',
        url:'/search/clearhistory',
        data:params
    })
}

//历史和热门搜索请求 
export function getSearchIndexDate(params) {
    return instance({
        method:'get',
        url:'/search/index',
        params
    })
}

//获取收货地址请求 
export function getAddressDate(params) {
    return instance({
        method:'get',
        url:'/address/list',
        params,
        //   headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    })
}

//获取省市区信息请求 
export function getRegionDate(params) {
    return instance({
        method: 'post',
        url: '/region/list',
        params,
    })
}

//添加收货地址请求 
export function addAddressDate(params) {
    return instance({
        method:'post',
        url:'/address/save',
        data:params,
    })
}